package com.zr.util;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
public class DownService {
    public ResultVO<DownList> getPullDownList(List list) {
        DownList down=new DownList();
        if(list.contains("type")){
            List<Type> type=new ArrayList<>();
            for (int i=1;i<=TypeEnum.values().length;i++){
                Type type1 = new Type(TypeEnum.getLabel(i),i);
                type.add(type1);
            }
            down.setType(type);
        }
        if(list.contains("inquiryStatus")){
            List<Type> inquiryStatus=new ArrayList<>();
            for (int i=1;i<=InquiryStatusEnum.values().length;i++){
                Type type2 = new Type(InquiryStatusEnum.getLabel(10*i),10*i);
                inquiryStatus.add(type2);
            }
            down.setInquiryStatus(inquiryStatus);
        }
        if(list.contains("isTax")){
            List<Type> isTax=new ArrayList<>();
            for (int i=1;i<=IsTaxEnum.values().length;i++){
                Type type2 = new Type(IsTaxEnum.getLabel(i),i);
                isTax.add(type2);
            }
            down.setIsTax(isTax);
        }
        if(list.contains("currencyCode")){
            List<Type> currencyCode=new ArrayList<>();
            for (int i=1;i<=CurrencyCodeEnum.values().length;i++){
                Type type2 = new Type(CurrencyCodeEnum.getLabel(i),i);
                currencyCode.add(type2);
            }
            down.setCurrencyCode(currencyCode);
        }
        return ResultVOBuilder.success(down);
    }
}
